
#pragma once

#include <AVUIDefinitionBase.h>

namespace AVUI {

class Grid;

class ColumnDefinition : public DefinitionBase
{
    friend class ColumnDefinitionCollection;

public:
    ColumnDefinition() : DefinitionBase(true), m_pOwner(NULL) { }

    DECLARE_ELEMENT(ColumnDefinition, DefinitionBase);

    DECLARE_DEPENDENCY_PROPERTY(Width);
    GridLength get_Width() { return AVUI::UnboxValue<GridLength>(GetValue(get_WidthProperty())); }
    void set_Width(const GridLength& value) { SetValue(get_WidthProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(MinWidth);
    float get_MinWidth() { return AVUI::UnboxValue<float>(GetValue(get_MinWidthProperty())); }
    void set_MinWidth(float value) { SetValue(get_MinWidthProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(MaxWidth);
    float get_MaxWidth() { return AVUI::UnboxValue<float>(GetValue(get_MaxWidthProperty())); }
    void set_MaxWidth(float value) { SetValue(get_MaxWidthProperty(), AVUI::BoxValue(value)); } 

    float get_ActualWidth();

private:
    static void StaticConstructor();

    static void OnPropertyChanged(DependencyObject* pDO, DependencyPropertyChangedEventArgs* e);

    void set_Owner(Grid* pOwner)
    {
        if(m_pOwner != NULL)
        {
            LibraryCriticalError();
        }

        m_pOwner = pOwner;
    }

    Grid* m_pOwner;

};



}; // namespace AVUI
